home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS02.ADF
/
ABasicStuff
/
terminal.bas
< prev
next >
Wrap
BASIC Source File
|
1989-05-30
|
13KB
|
295 lines
1000 ' EZ-TERM V.2.19 - - - - - - 12/08/85
1010 '
1020 ' by Kelly Kauffman
1030 '
1040 ' Xmodem Receive and Send were taken from a program written by
1050 ' K. L. Colclasure -----=====>>>>>Thanx
1060 ' Program only supports 300 baud due to how sslllooowww ABasiC is.
1070 ' Have fun!
1080 '
1085 on error goto 4000
1086 close 1:open "i",#1,"ram:date":close 1
1090 graphic (0):screen 1,1,0:gosub 2520
1100 print "ALT+Q - Quit Program ALT+SPACE - Time/Date"
1110 dim a$(6000)
1120 rem kelly kauffman, 3170 sprout way, sparks, nv, 89431: CIS [70206,640]
1130 rgb 0,0,0,10:rgb 1,12,12,12:rgb 3,0,0,15:rgb 2,12,0,4
1140 ?:?:?
1150 print spc(1);inverse(1); "To send Control Characters, hold down ALT & CTRL, and press the ctrl key.";inverse(0):gosub 1260
1160 print:print
1170 print " EZ-TERMINAL VER 2.27":print " by Kelly Kauffman"
1180 on error goto 3800
1190 ? :?" FOR PUBLIC USE ONLY"
1200 ?:?:?spc(7);"Put mouse in this window, and click LEFT button to get rollin'"
1210 ?:?:?" [HELP] is available."
1220 ask mouse x%,y%,b%:if b%<>4 then ?:?spc(25);:shell "ram:date":?
1230 get char$
1240 if char$<>"" then if asc(char$)=155 then gosub 1480
1250 gosub 1350:gosub 1410:print char$;:goto 1230
1260 baud%=300
1270 iobase%=&hdff000
1280 serdatr%=&h18+iobase%
1290 serdat%=&h30+iobase%
1300 serper%=&h32+iobase%
1310 intreq%=&h9c+iobase%
1320 poke_w serper%,(1/baud%)/(.2794*1e-06)
1330 return
1340 'write
1350 if char$="" then return
1360 if asc(char$)>159 then goto 5000
1370 poke_w serdat%,asc(char$)+256
1380 if plex=1 then gosub 3840
1390 return
1400 'read
1410 char%=peek_w(serdatr%)
1420 if (char% and 16384) = 0 then char$="":return
1430 if len(buff$)>253 then a$(num)=buff$:num=num+1:buff$=""
1440 char$=chr$(char% and 127):poke intreq%,8:if cap=1 then buff$=buff$+char$
1450 if asc(char$)=13 and lf=1 then ?:if cap=1 then buff$=buff$+chr$(10)
1460 return
1470 gosub 1400: print char$;:goto 1470
1480 get char$
1490 if char$="" then return
1500 if asc(char$)<48 or asc(char$)>63 then return
1510 if asc(char$)=48 and cap=1 then cap=0:num=num+1:a$(num)=buff$:buff$="":get char$:get char$:gosub 2730:return
1520 if asc(char$)=48 and cap=0 then cap=1:gosub 2670
1530 if asc(char$)=48 then get char$:get char$:a$(num)=buff$:buff$="":return
1540 if asc(char$)=49 and lf=0 then lf=1:?:?" Simulated Linefeeds ON":get char$:get char$:return
1550 if asc(char$)=49 and lf=1 then lf=0:?:?" Simulated Linefeeds OFF":get char$:get char$:return
1560 if asc(char$)=50 and buff$="" and num=0 then ?:print " B U T T H E R E'S N O T H I N G T O S A V E ! ! !"
1570 if asc(char$)=50 and len(buff$)=0 and num=0 then get char$:get char$:return
1580 if asc(char$)=50 then cap=0:num=num+1:a$(num)=buff$:buff$=""
1590 If asc(char$)=50 then get car$:get car$:input "Save as ->";file$
1600 if asc(char$)=50 then if file$="" then ?"Aborted.":get a$:get a$:return else open "o",#4,file$
1610 if asc(char$)=50 then for q=0 to num:? #4,a$(q);:next q:close #4:?" C A P T U R E B U F F E R S A V E D"
1620 if asc(char$)=51 then num=num+1:a$(num)=buff$:buff$=""
1630 if asc(char$)=51 then gosub 3700:return
1640 gosub 1670
1650 get char$:get char$
1660 return
1670 rem
1680 if asc(char$)=53 then gosub 1970:return
1690 if asc(char$)=52 then gosub 1760:return
1700 if asc(char$)=54 then gosub 2200:return
1710 if asc(char$)=63 then gosub 2230:return
1720 if asc(char$)=55 then gosub 2410:return
1730 if asc(char$)=56 then gosub 3670:gosub 2870:get char$:get char$:return
1740 if asc(char$)=57 then gosub 3670:gosub 3360:get char$:get char$:return
1750 return
1760 scnclr
1770 get char$:get char$
1780 rem
1790 input "Load what Filename ------>";file$
1800 if file$="" then print "Aborted.":goto 1940
1810 erase a$:dim a$(6000)
1820 x=instr(1,file$,".bas"):y=instr(1,file$,".BAS"):if x=0 and y=0 then bas=0 else bas=1
1830 close #4
1840 num=0
1850 open "i",#4,file$
1860 on error goto 3800
1870 if bas=1 then line input #4,buff$ else get #4,w$
1880 if bas<>1 and w$="" then 1930
1890 if bas=1 then a$(num)=buff$ else b=len(a$(num)):if b>253 then num=num+1:a$(num)=a$(num)+w$
1900 if bas<>1 and b<=253 then a$(num)=a$(num)+w$
1910 if bas=1 then num=num+1:buff$=""
1920 if not eof(4) then 1870
1930 print "Complete File Loaded."
1940 on error goto 3800
1950 close #4
1960 return
1970 scnclr
1980 print
1990 get char$:get char$
2000 input "Do you want to use prompts"; yn$:if yn$="n" or yn$="N" then prompt=0 else prompt=1
2010 print :print"Do you want a return sent after each line":input yn$:if yn$="Y" or yn$="y" then retn=1 else retn=0
2020 scnclr
2030 print " Beginning Upload":gosub 2800
2040 get char$:get char$
2050 for i=0 to num
2060 for q=1 to len(a$(i))
2070 qwer=asc(mid$(a$(i),q,1)): if bas=1 and qwer=10 then qwer=13
2080 get char$:if char$<>"" then print:?:?"UPLOAD ABORTED BY USER":print:print:gosub 2840:goto 2190
2090 poke_w serdat%,qwer+256
2100 print mid$(a$(i),q,1);
2110 if baud%=300 then sleep 13000
2120 next q
2130 if retn=1 then poke_w serdat%,269:print
2140 if prompt=1 then gosub 2490
2150 next i
2160 print:print
2170 print "Buffer Upload Complete."
2180 gosub 2840
2190 return
2200 if plex=1 then plex=0:?:?:print " F U L L D U P L E X":goto 2220
2210 if plex=0 then plex=1:?:?:print " H A L F D U P L E X"
2220 get char$:get char$:return
2230 scnclr
2240 print "F1 - Toggles Capture on/off to capture incoming data and save inthe buffer."
2250 print "F2 - Toggles Simulated LineFeeds On/Off. Turn on if you get type-overs."
2260 print "F3 - Save Capture Buffer. Saves the contents of the buffer to a file of your choice."
2270 print "F4 - Review Buffer. Lets you see the contents of the buffer. Press any key during the review to abort."
2280 ?"F5 - Load Buffer. This will load a file of your choice into the Buffer."
2290 ?" NOTE: It does NOT merge the data, it clears out the old info then loads the new."
2300 print "F6 - Upload Buffer. The question about prompts means that the Amgia will"
2310 print " wait for the computer you are hooked up with sends a prompt character."
2320 print " This character is the "">"" character. If you are sending other than a"
2330 print " source code, reply ""N""o to this question, then the Amiga will just"
2340 print " upload the entire buffer without waiting for prompts."
2350 ? "F7 - Duplex Toggle. Toggles between Full and Half duplex for seeing what you are typing."
2360 print "F8 - Clear buffer. Clears out the capture/upload/review buffer."
2370 print "F9 - Xmodem Receive."
2380 print "F10- Xmodem Send."
2390 print "ALT + Q - Quit Program ALT + SPACE - Time/Date"
2400 return
2410 print
2420 print
2430 print " B U F F E R C L E A R E D"
2440 erase a$
2450 dim a$(6000)
2460 buff$=""
2470 num=0
2480 return
2490 gosub 1400
2500 if char$<>">" then 2490
2510 return
2520 rem draw windows for Function definitions
2530 window #1,0,200,640,100,"Function Key Definitions"
2540 cmd 1
2550 ? inverse(0);"Cap Off";
2560 print inverse(0);" ";inverse(1);"F3";inverse (0);
2570 print "-Save ";inverse(1);"F4";inverse(0);"-Rvw ";inverse(1);"F5";inverse(0);
2580 print "-Load ";inverse(1);"F6";inverse(0);"-Upload ";inverse(1);"F7";
2590 print inverse(0);"-Duplex ";inverse(1);"F8";inverse(0);"-Clear ";
2600 print inverse(1);"F9";inverse(0);"-XRec ";inverse(1);"F1";inverse(0);"0-XSnd";
2610 print at(71,0);
2620 window #2,0,0,640,186," EZ-TERM V2.19 ------======>by Kelly Kauffman<======------ "
2630 cmd 2
2640 return
2650 close #1,2
2660 end
2670 cmd #1
2680 rem capture On
2690 print at(0,0);inverse(1);"Cap On";inverse(0);" ";
2700 print at(71,0);
2710 rgb 0,10,0,0
2720 cmd #2:return
2730 rem
2740 cmd #1
2750 rem capture off
2760 print at(0,0);inverse(0);"Cap Off";
2770 print at(71,0);
2780 rgb 0,0,0,10
2790 cmd #2:return
2800 cmd #1
2810 print at(35,0);inverse(1);"Upload";
2820 print at(71,0);
2830 cmd 2:return
2840 cmd #1
2850 print at(35,0);inverse(0);"Upload";at (78,0);
2860 cmd 2:return
2870 goto 3180:' XMODEM RECEIVE & SEND -----------------------------
2880 size% = 5: timeout% = 500: baud% = 300
2890 gosub 3670: goto 3110
2900 key% = asc(key$): poke_w out%, key% + 256
2910 if key$=nak$ then sleep 35000
2920 return
2930 gflag% = 0: char% = peek_w(in%)
2940 if (char% and 16384) = 0 then return else gflag% = -1
2950 char% = char% and 127: poke intrq%, 8: return
2960 t = 0: toflag% = 0
2970 char% = peek_w(in%)
2980 if (char% and 16384) = 0 then t = t + 1 else 3010
2990 if t > timeout% then toflag% = -1: return
3000 goto 2970
3010 char% = char% and 255: poke intrq%, 8: return
3020 cksum% = 0: for i = 1 to 131
3030 cksum% = (cksum% + buf%(n,i)) and 255: next i
3040 if cksum% = buf%(n,132) then 3060
3050 sleep 10000:print spc(20);"Cksum error in"; blk%: key$ = nak$: return
3060 mblk% = blk% and 255
3070 if mblk% = buf%(n,2) then 3090
3080 sleep 10000:print spc(20);"Sync error in"; blk%: key$ = nak$: return
3090 blk% = blk% + 1: n = n + 1: key$ = ack$
3100 print spc(20);" Received"; blk% - 1; chr$(13);: return
3110 goto 1260
3120 print: on error goto 0
3130 get key$: if key$ = "" then 3160
3140 if key$ = chr$(155) then 3660
3150 gosub 2900
3160 gosub 2930: if (gflag%) then print chr$(char%);
3170 goto 3130
3180 get char$:get char$:print: print "Xmodem Receive, enter filename: ";
3190 line input file$: if file$ = "" then ?" Aborted.":?:?:goto 3110
3200 open "o",#5,file$:rem close #5
3210 blk% = 1: n = 1: eotflag% = 0: key$ = nak$
3220 gosub 2900: for i = 1 to 132: gosub 2960
3230 if (toflag%) then key$ = nak$: goto 3220
3240 if (i = 1) and (char% = eot) then 3270
3250 buf%(n,i) = char%: next i: gosub 3020
3260 if n > top% then 3280 else 3220
3270 eotflag% = -1
3280 rem open "a",#5,file$
3290 for x = 1 to (n - 1): for y = 4 to 131
3300 print #5, chr$(buf%(x,y));
3310 next y,x
3320 Rem close #5
3330 if not (eotflag%) then n = 1: goto 3220
3340 gosub 2900
3350 close #5:print: print "Transfer complete ...": goto 3110
3360 get char$:get char$:print: print "Xmodem Send, enter filename: ";
3370 line input file$: if file$ = "" then ?" Aborted.":?:?:?:goto 3110
3380 on error goto 0
3390 open "i",#5,file$
3400 on error goto 0
3410 n = lof(5): n = n / 128
3420 if int(n) < n then n = int(n) + 1 else n = int(n)
3430 print "File open,";n;"records."
3440 n = 1: blk% = 1
3450 buf%(n,1) = soh: buf%(n,2) = blk% and 255
3460 buf%(n,3) = buf%(n,2) xor 255
3470 for i = 4 to 131
3480 if not eof(5) then get #5, char$ else char$ = eof$
3490 buf%(n,i) = asc(char$): next i
3500 gosub 3570: gosub 3600: print spc(20);" Sent block"; blk%; chr$(13);
3510 if not eof(5) then blk% = blk% + 1: goto 3450
3520 close #5
3530 key$ = chr$(eot): gosub 2900
3540 gosub 2930: if not gflag% then 3540
3550 if char% = nak then 3530
3560 if char% = ack then 3350 else 3540
3570 cksum% = 0: for i = 1 to 131
3580 cksum% = (cksum% + buf%(n,i)) and 255: next i
3590 buf%(n,132) = cksum%: return
3600 if blk% = 1 then 3630
3610 for i = 1 to 132: key$ = chr$(buf%(n,i))
3620 gosub 2900: sleep 30000: next i
3630 gosub 2930: if not gflag% then 3630
3640 if char% = nak then 3610
3650 if char% = ack then return else 3630
3660 get key$: if key$ = "" then 3130 else fkey% = asc(key$)
3670 ack$=chr$(6):nak$=chr$(21):eot$=chr$(4):ack=6:nak=21:eot=4:soh=1:eof$=chr$(26):timeout%=500:size%=5
3680 erase buf%
3690 option base 1:dim buf%(size%*8,132):top%=size%*8:baudr%=&hdff032:out%=&hdff030:in%=&hdff018:intrq%=&hdff09c:return
3700 scnclr:print:print
3710 get char$:get char$
3720 for q=0 to num
3730 if bas=1 then print a$(q)
3740 if bas=0 then print a$(q);
3750 get char$
3760 if char$<>"" then ?:?:?:?"Buffer Review Aborted.":get char$:return
3770 next q
3780 ?:?:?:?"Buffer Review Completed."
3790 return
3800 print "---===>>>";err$(err);"<<<===--- at line ";erl
3810 print:print
3820 on error goto 3800
3830 resume 1340
3840 print char$;
3850 if cap=1 then buff$=buff$+char$
3860 if asc(char$)=13 then ?
3870 return
4000 shell "copy c/date to ram:date"
4010 resume 1086
5000 if asc(char$)=241 or asc(char$)=209 then 2650
5010 if asc(char$)=160 then ?:?spc(25);:shell "ram:date":?:char$="":goto 1340